#include <SFML\Graphics.hpp>
#include "Menu.h"
#include "GameState.h"
//Main.cpp is the Menu state
int main()
{
	
	sf::RenderWindow window(sf::VideoMode(800,600), "Project Zombie");
	//window.setFramerateLimit(60);
	    // run the program as long as the window is open
	GameState game;
	Menu menu(window);
	menu.startStopMusic(true);
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
			switch(event.type) 
			{
			case sf::Event::Closed:
                window.close();;
			case sf::Event::KeyPressed:
				if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
				{
					menu.setCurrentItem(menu.getCurrentItem() + 1);
						menu.menuUpdate();
				}
				else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
				{
					menu.setCurrentItem(menu.getCurrentItem() - 1);
						menu.menuUpdate();
				}
				else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Return))
				{
					if(menu.getCurrentItem() == 1)
					{
					game.StartGame(window);
					}
				}
				else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
				{
					window.close();
				}
			}
        }

		window.clear(sf::Color::Black);
        // draw everything here...
		menu.drawMenuElements(window);
        // end the current frame
        window.display();
    }

    return 0;
}